package com.ruoyi.develop.factory.factoryTestSurface.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.develop.factory.factoryProductStore.domain.FactoryProductStore;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.develop.factory.factoryTestSurface.domain.FactoryTestSurface;
import com.ruoyi.develop.factory.factoryTestSurface.service.IFactoryTestSurfaceService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 出厂试验-机械试验-悬垂线夹和连接金具Controller
 * @author lmm
 * @date 2024-11-05
 */
@RestController
@RequestMapping("/factoryTestSurface/factoryTestSurface")
public class FactoryTestSurfaceController extends BaseController {
    @Autowired
    private IFactoryTestSurfaceService factoryTestSurfaceService;

    /**
     * 查询出厂试验-机械试验-悬垂线夹和连接金具列表
     */
    @PreAuthorize("@ss.hasPermi('develop:FactoryTestSurface:query')")
    @GetMapping("/list")
    public TableDataInfo list(FactoryTestSurface entity) {
        startPage();
        List<FactoryTestSurface> list = factoryTestSurfaceService.selectList(entity);
        return getDataTable(list);
    }


    /**
     * 根据到货查询 悬垂线夹和连接金具列表
     */
    @PreAuthorize("@ss.hasPermi('develop:FactoryTestSurface:query')")
    @GetMapping("/listByFahuoDetail")
    public TableDataInfo listByFahuoDetail(FactoryTestSurface entity) {
        startPage();
        List<FactoryTestSurface> list = factoryTestSurfaceService.selectListByFahuoDetail(entity);
        return getDataTable(list);
    }

    /**
     * 导出出厂试验-机械试验-悬垂线夹和连接金具列表
     */
    @PreAuthorize("@ss.hasPermi('develop:FactoryTestSurface:export')")
    @Log(title = "出厂试验-机械试验-悬垂线夹和连接金具", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, FactoryTestSurface entity) {
        List<FactoryTestSurface> list = factoryTestSurfaceService.selectList(entity);
        ExcelUtil<FactoryTestSurface> util = new ExcelUtil<FactoryTestSurface>(FactoryTestSurface. class);
        util.exportExcel(response, list, "出厂试验-机械试验-悬垂线夹和连接金具数据");
    }

    /**
     * 获取出厂试验-机械试验-悬垂线夹和连接金具详细信息
     */
    @PreAuthorize("@ss.hasPermi('develop:FactoryTestSurface:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id) {
        return AjaxResult.success(factoryTestSurfaceService.selectById(id));
    }

    /**
     * 新增出厂试验-机械试验-悬垂线夹和连接金具
     */
    @PreAuthorize("@ss.hasPermi('develop:FactoryTestSurface:add')")
    @Log(title = "出厂试验-机械试验-悬垂线夹和连接金具", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody FactoryTestSurface entity) {
        return toAjax(factoryTestSurfaceService.insert(entity));
    }

    /**
     * 修改出厂试验-机械试验-悬垂线夹和连接金具
     */
    @PreAuthorize("@ss.hasPermi('develop:FactoryTestSurface:edit')")
    @Log(title = "出厂试验-机械试验-悬垂线夹和连接金具", businessType = BusinessType.UPDATE)
    @PutMapping("/edit")
    public AjaxResult edit(@RequestBody FactoryTestSurface entity) {
        return toAjax(factoryTestSurfaceService.update(entity));
    }

    /**
     * 删除出厂试验-机械试验-悬垂线夹和连接金具
     */
    @PreAuthorize("@ss.hasPermi('develop:FactoryTestSurface:remove')")
    @Log(title = "出厂试验-机械试验-悬垂线夹和连接金具", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids) {
        return toAjax(factoryTestSurfaceService.deleteByIds(ids));
    }
}
